import { requestClient } from '#/api/request';
import type { ExamInfo } from './type';
/**
 * 创建考试
 */
export async function createExamInfoApi(data:any) {
  return requestClient.post('/exam/create-exam-info', data);
}

/**
 * 发布考试
 */
export async function publishExamInfoApi(data:any) {
  return requestClient.post('/exam/publish-exam-info', data);
}

/**
 * 修改考试
 */
export async function updateExamInfoApi(data:any) {
  return requestClient.patch('/exam/update-exam-info', data);
}

/**
 * 复制考试
 */
export async function copyExamInfoApi(id:any) {
  return requestClient.post(`/exam/copy-exam-info/${id}`);
}

/**
 * 查询考试信息
 **/

export async function getExamInfoApi(params:any) {
  return requestClient.get('/exam/get-exam-info', { params });
}

/**
 * 查询考试列表(包含考试概况)
 **/

export async function getExamInfoWithSituationApi(params:any) {
  return requestClient.get('/exam/get-exam-info-with-situation', { params });
}

/**
 * 删除考试
 */
export async function deleteExamInfoApi(id:any) {
  return requestClient.delete(`/exam/delete-exam-info/${id}`);
}

/**
 * 查询课程
 * **/
export async function getCourseInfoApi(params:any) {
  return requestClient.get('/course/get-course-info', {params});
}

/**
 * 查询认证
 * **/
export async function getCertificationInfoApi(params:any) {
  return requestClient.get('/certification/get-certification-info-by-condition', {params});
}

/**
 * 查询成绩分布
 * **/
export async function getExamScoreDistributionApi(params:any) {
  return requestClient.get('/exam/get-exam-score-distribution', {params});
}

/**
 * 考生表现
 * **/ 
export async function getExamScoreByOrganizationApi(params:any) {
  return requestClient.get('/exam/get-exam-score-by-organization', {params})
}

/**
 * 录入成绩
 * **/
export async function inputExamScoreApi(data:any) {
  return requestClient.post('/exam/input-exam-score', data)
}

/**
 * 公布成绩
 * **/ 
export async function publishExamScoreApi(data:any) {
  return requestClient.post('/exam/publish-exam-score', data)
}

// 查询考试信息
export async function getExamInfoForUserApi(examId: string) {
  return requestClient.get<ExamInfo>(`/exam/get-exam-info-for-user/${examId}`);
}

/**
 * 开始考试
 * **/
export async function startExamForUserApi(examId: string) {
  return requestClient.post(`/exam/start-exam-for-user/${examId}`);
}

/**
 * 查看考试试题
 * **/
export async function getExamPaperQuestionForUserApi(examScoreId: string) {
  return requestClient.get(`/exam/get-exam-paper-question-for-user/${examScoreId}`);
}

/**
 * 立即生成证书
 * **/ 
export async function createCertificateApi(data:any) {
  return requestClient.post('/certification/create-user-certificate', data)
}

/**
 * 保存批改成绩
 * **/ 
export async function saveExamMarkScoreApi(data:any) {
  return requestClient.post('/exam/save-exam-mark-score', data)
}

/**
 * 完成批改成绩
 * **/ 
export async function completeExamMarkScoreApi(data:any) {
  return requestClient.post('/exam/complete-exam-mark-score', data)
}

/**
 * 获取学员考试每道题得分列表
 * **/ 
export async function getExamUsersScoreApi(params:any) {
  return requestClient.get('/exam/get-exam-users-score', {params})
}

/**
 * 获取考试用户列表
 * **/ 
export async function getExamUsersListApi(params:any) {
  return requestClient.get('/exam/get-exam-users-list', {params})
}


/**
 * 获取学员考试结果对比列表
 * **/ 
export async function getExamUsersAnswerApi(params:any) {
  return requestClient.get('/exam/get-exam-users-answer', {params})
}

/**
 * 保存答案结果
 * **/ 
export async function saveExamAnswerResultForUserApi(data: any) {
  return requestClient.post('/exam/save-exam-answer-result-for-user', data);
}

/**
 * 查询当前用户对应认证下的考试id
 * **/ 
export async function getExamIdByUserCertificationApi(certificationId: string) {
  return requestClient.get(`/exam/get-exam-id-by-user-certification/${certificationId}`)
}
/**
 * 保存存疑结果（用户端）
 * @param params 请求参数
 */
export async function markExamDoubtfulAnswerForUserApi(params: any) {
  return requestClient.get('/exam/mark-exam-doubtful-answer-for-user', { params });
}

/**
 * 查询用户考试复制次数
 * @param examScoreId 考试成绩ID
 */
export async function queryExamCopyCountForUserApi(data: {examScoreId: string}) {
  return requestClient.get(`/exam/query-exam-copy-count-for-user/${data.examScoreId}`);
}

/**
 * 保存用户考试复制次数
 * @param examScoreId 考试成绩ID
 */
export async function saveExamCopyCountForUserApi(examScoreId: string) {
  return requestClient.get(`/exam/save-exam-copy-count-for-user/${examScoreId}`);
}

/**
 * 查询切屏次数（用户端）
 * @param examScoreId 考试成绩ID
 */
export async function queryExamCutCountForUserApi(examScoreId: string) {
  return requestClient.get(`/exam/query-exam-cut-count-for-user/${examScoreId}`);
}

/**
 * 保存切屏次数（用户端）
 * @param examScoreId 考试成绩ID
 */
export async function saveExamCutCountForUserApi(examScoreId: string) {
  return requestClient.get(`/exam/save-exam-cut-count-for-user/${examScoreId}`);
}
